import axios from "axios";

//请求封装文件
const BaseUrl = "http://106.12.150.223:8090/api/private/v1/";
const request = (option: any) => {
  return new Promise((resolve, reject) => {
    option.url = BaseUrl + option.url;
    axios({
      ...option,
      headers: {
        Authorization: `${localStorage.getItem("Stytoken")}`,
      },
    })
      .then((res: any) => {
        resolve(res.data);
        console.log("请求结果", res.data);
      })
      .catch((err) => {
        reject(err);
      });
  });
};
export default request;
